﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSP.Model.CSP;
using CSP.Model.CSPEnum;

namespace CSP.Dao.IObjectDaos.CSP
{
    public interface IServiceInfoDao : ICSPDao<ServiceInfo>
    {
        /// <summary>
        /// 查找用户下服务信息数据
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageCount"></param>
        /// <returns></returns>
        ICollection<ServiceInfo> FindByUser(string userName, int pageIndex, int pageSize, out int pageCount);

        /// <summary>
        /// 获取剩余服务库存量
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int GetSurplusEnjoyCountById(int id);

        /// <summary>
        /// 创建一个ServiceInfo  并返回创建成功的实例
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        ServiceInfo CreateServiceInfo(ServiceInfo obj);

        /// <summary>
        /// 更新状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="serviceStatus"></param>
        /// <returns></returns>
        ServiceInfo UpdateStatus(int id, ServiceInfoStatus serviceStatus);

        /// <summary>
        /// 根据用户名获取 Id
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        List<int> FindIdsByUser(string userName);

        /// <summary>
        /// 根据Id 和userName 获取数据
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        ServiceInfo GetByIdAndUser(int id, string userName);

        /// <summary>
        /// 根据id和username 删除数据
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        ServiceInfo DeleteByIdAndUser(int id, string userName);

        /// <summary>
        /// 根据title和userName获取数据
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="title"></param>
        /// <returns></returns>
        List<int> FindByuserNameAndTitle(string userName, string title);

        /// <summary>
        /// 根据Ids 及分页参数获取数据
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        ICollection<ServiceInfo> FindByIds(List<int> ids, int pageIndex, int pageSize);

        /// <summary>
        /// 根据Ids 及status 获取结果Id
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        List<int> FindIdsByIdsAndStatus(List<int> ids, ServiceInfoStatus status);

        /// <summary>
        /// 根据当前用户和数据状态获取总数量
        /// </summary>
        /// <returns></returns>
        int GetCountByUserAndStatus(string userName, ServiceInfoStatus status);

    }
}
